package com.neuedu.javase.operation;

/**
 * @author :金山老师
 * date    :  2025/10/16 14:22
 * project  : MyJavaSE
 * 描述      ： 赋值运算
 */
public class OperationAssignment {


    public static void main(String[] args) {

        int numa;

        //赋值运算
        numa = 100;

        System.out.println("numa = " + numa);

        int numb = 2;
        int numc = 10;
        System.out.println("numb = " + numb);
        System.out.println("numc = " + numc);


        // numb = numb + 100;
        numb += 100;   //102

        System.out.println("numb += 100 = " + numb);  // 102

        // numb = numb - 50;
        numb -=50;   //52
        System.out.println("numb -=50 = " + numb);  // 52


        // numb = numb * 2 ;
        numb *=2;   //104
        System.out.println("numb *=2 = " + numb);  // 104


        // numb = numb / 3 ;
        numb /=3;   // 34
        System.out.println("numb /=3 = " + numb);  // 34

        numb %=3;   // 1
        System.out.println("numb %=3 = " + numb);  // 1




        //赋值表达式  也有结果
        int myNuma = 10;
        int myNumb = 5;


        System.out.println( myNuma + myNumb);   // 15

        // 赋值运算的结果 就是变量的结果
        //myNuma += 20         myNuma  =  myNuma + 20
        System.out.println( (myNuma += 20   ) + 20);    //50







    }


}
